var Action = require("../apiaction");
var Utility = require("../Utility/utility.js");
exports.studyAPI = function(router){


    //列表获取
    router.all('/study/getListPaging', function (req, res) {

        var params = {};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/getListPaging", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //添加
    router.all('/study/add', function (req, res) {

        var params = {pic_url: req.param("pic_url"),link_url: req.param("link_url"),title: req.param("title")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/add", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //更新
    router.all('/study/update', function (req, res) {

        var params = {pic_url: req.param("pic_url"),link_url: req.param("link_url"),title: req.param("title"), obj_id: req.param("obj_id")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/update", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //删除
    router.all('/study/delete', function (req, res) {

        var params = {obj_id: req.param("obj_id")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/delete", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //评论列表获取
    router.all('/study/commentlist', function (req, res) {

        var params = {study_id: req.param("study_id")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/commentlist", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //点赞列表获取
    router.all('/study/starlist', function (req, res) {

        var params = {study_id: req.param("study_id")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/starlist", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });

    //删除
    router.all('/study/deletecomment', function (req, res) {

        var params = {obj_id: req.param("obj_id")};
        params = Utility.get_list_page_size_param(req, params);

        Action.send(req, res, "/study/deletecomment", params, function (res, data) {
            res.status(200).json(JSON.parse(data));
        });
    });










}
